home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-19 | 4.0 KB | 148 lines | [TEXT/KAHL] |
- /******************************************************************************
- CProcessArrayPane.c
-
- CProcessArrayPane ArrayPane Class
-
- Copyright © 1994 Chris Prinos, Symantec Corp.. All rights reserved.
-
- Generated by Visual Architect™ 11:44 AM Sun, Mar 13, 1994
-
- This file is only generated once. You can modify it by filling
- in the placeholder functions and adding any new functions you wish.
-
- If you change the name of the document class, a fresh version of this
- file will be generated. If you have made any changes to the file
- with the old name, you will have to copy those changes to the new
- file by hand.
-
- ******************************************************************************/
-
- #include "CProcessArrayPane.h"
- #include <strings.h>
-
- TCL_DEFINE_CLASS_D1(CProcessArrayPane, x_CProcessArrayPane);
-
- /**** C O N S T R U C T I O N / D E S T R U C T I O N M E T H O D S ****/
-
-
- /******************************************************************************
- PutTo
-
- Put the contents of this object to the stream
- ******************************************************************************/
-
- void CProcessArrayPane::PutTo(
- CStream &aStream)
- {
- // Put any additional data members for this class
- // before calling the superclass PutTo.
-
- // If you have no additional data members, the
- // PutTo and GetFrom functions can be eliminated.
-
- x_CProcessArrayPane::PutTo(aStream); /* Let superclass save */
-
- // By convention, any subordinate objects are put
- // after the superclass has had a chance to write
- // its instance variables.
- }
-
-
- /******************************************************************************
- GetFrom
-
- Get the contents of this object from the stream and
- initialize the object
- ******************************************************************************/
-
- void CProcessArrayPane::GetFrom(
- CStream &aStream)
- {
- // Get any additional data members for this class
- // before calling the superclass GetFrom
-
-
- /* Let superclass restore */
- x_CProcessArrayPane::GetFrom(aStream);
-
- // Restore any subordinate objects below
-
- // ••••• Visual Architect Tutorial Code Change Begin •••••
- // assign the apps process
- // list as the one to use for this
- // array pane
- fCurrentMode = byName;
- SetArray( ((CApp *)gApplication)->fProcessList, false);
- // ••••• Visual Architect Tutorial Code Change End •••••
- }
-
- // ••••• Visual Architect Tutorial Code Change Begin •••••
- // GetCellText(Cell, short, StringPtr)
- //
- // Tells CProcessArrayPane how to draw it's cells. Each cell will display
- // the name, signature, or PSN of the corresponding CProcess object.
- // Whatever the mode, the final result gets stuffed into itsText so that
- // the table can display the appropriate string
- //
- void CProcessArrayPane::GetCellText( Cell aCell, short availableWidth, StringPtr itsText)
- {
- CProcess *proc;
-
- itsArray->GetArrayItem(&proc, aCell.v+1);
-
- switch(fCurrentMode) // display according to current view mode
- {
- case byName:
- CopyPString (proc->GetProcessName(), itsText);
- break;
-
- case byPSN:
- ProcessSerialNumber PSN = proc->GetPSN();
- Str255 PSNString;
- sprintf((char *)PSNString, "%.4lu%.4lu",PSN.highLongOfPSN, PSN.lowLongOfPSN);
- #ifdef TCL_POWER_PC
- c2pstr((char *)PSNString);
- #else
- CtoPstr((char *)PSNString);
- #endif
- CopyPString( PSNString, itsText);
- break;
-
- case bySig:
- long sig;
- itsText[0] = 6;
- itsText[1] = '\'';
- itsText[6] = '\'';
- sig = proc->GetSignature();
- * ((long*)&itsText[2]) = sig;
- break;
- }
-
- }
-
- // GetProcessItem
- //
- // Given a index number of the ProcessArrayPanes process list,
- // return a pointer to the CProcess at that position.
- //
- const CProcess *CProcessArrayPane::GetProcessItem(long index) const
- {
- CProcess *proc;
-
- itsArray->GetArrayItem(&proc, index);
- return proc;
- }
-
-
- // ChangeView
- //
- // Set the display mode for this CProcessArrayPane. This decides the format
- // that processes are displayed in.
- //
- void CProcessArrayPane::ChangeView(ProcessDisplayMode newMode)
- {
- fCurrentMode = newMode;
- }
-
- // ••••• Visual Architect Tutorial Code Change End •••••
-